package com.grad.why.studentsystem.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.grad.why.studentsystem.domain.current.CurrentHeadInfos;
import com.grad.why.studentsystem.domain.current.CurrentRuntimeHeadInfos;
import com.grad.why.studentsystem.mapper.FinalheadresultinfoMapper;
import com.grad.why.studentsystem.mapper.RunningheadcamerainfosMapper;
import com.grad.why.studentsystem.service.HeadInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


@Component
@Service(interfaceClass = HeadInfoService.class)
public class HeadInfoServiceImpl implements HeadInfoService {

    @Autowired
    private FinalheadresultinfoMapper finalheadresultinfoMapper;

    @Autowired
    private RunningheadcamerainfosMapper runningheadcamerainfosMapper;

    @Override
    public List<CurrentHeadInfos> getHistoryHeadInfos(int offset, int limit, String search) {
        try{
            return finalheadresultinfoMapper.getHistoryHeadInfos(offset,limit,search);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public long getHistoryHeadInfosLength(String search) {
        try {
            return finalheadresultinfoMapper.getHistoryHeadInfosLength(search);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public int deleteHistoryInfoById(long l) {
        try{
            return finalheadresultinfoMapper.deleteByPrimaryKey(l);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public List<CurrentRuntimeHeadInfos> getRuntimeHeadInfos(int offset, int limit, String search) {
        try{
            return runningheadcamerainfosMapper.getRuntimeHeadInfos(offset,limit,search);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public long getRuntimeHeadInfosLength(String search) {
        try{
            return runningheadcamerainfosMapper.getRuntimeHeadInfosLength(search);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }
}
